package com.lvwenguo.controller.category;

import com.lvwenguo.service.CategoryListServiceInter;
import com.lvwenguo.service.serviceImple.CategoryListServiceImple;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

//品类管理页面数据展示
@WebServlet(urlPatterns = "/CategoryListServlet")
public class CategoryListServlet extends HttpServlet {
    CategoryListServiceInter categoryListServiceImpol =new CategoryListServiceImple();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
    //防止用户多次点击，造成域数据重复

        req.setAttribute("categoryList", categoryListServiceImpol.selectCategoryList());

        req.getRequestDispatcher("/view/category/category_list.jsp").forward(req,resp);

    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req,resp);
    }
}
